package com.sample.tdf.api;

import cn.com.taiji.common.api.BaseTreeController;
import cn.com.taiji.common.dto.ResultDTO;
import com.sample.tdf.dto.DepartStaffsDTO;
import com.sample.tdf.dto.DepartmentDTO;
import com.sample.tdf.service.IDepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = {"机构部门操作接口"})
@RequestMapping("/trainWork/department")
public class DepartmentController extends BaseTreeController<IDepartmentService, DepartmentDTO> {
    @Autowired
    private IDepartmentService iDepartmentService;

    @GetMapping("/getDepartStaffsTreeListById")
    @ApiOperation(value = "根据机构部门id查询员工，并且拼接为树结构")
    public ResultDTO findOrgEmpTreeById(String dId) {
        List<DepartStaffsDTO> departStaffDTOs = iDepartmentService.findDepartStaffTreeById(dId);
        return new ResultDTO(departStaffDTOs);
    }
}
